public class test6 {
    public static void main(String[] args) {
        int[] arr3 = new int[]{-99,-54,-2,0,2,33,43,256,999};
        int head=0;
        int value=-54;
        int end=arr3.length-1;
        boolean flag=false;
        while(head<=end){
            int mid=(head+end)/2;
            if(arr3[mid]==value){
                System.out.println("找到了，index为:"+ (mid/2));
                flag=true;
                break;
            } else if (arr3[mid]>value) {
                end=mid-1;
            }else{
                head=mid+1;
            }
        }
        if(!flag){
            System.out.println("没找到");
        }
    }
}
